package data

import (
	"eag_arch_layout/internal/model/model"
	"eag_arch_layout/internal/svc"
	"github.com/go-kratos/kratos/v2/log"
)

type systemRepo struct {
	data *BaseRepo
	log  *log.Helper
}

func (s systemRepo) GetLastVersion() (*model.SysVersion, error) {
	//
	var result *model.SysVersion
	s.data.db.Raw("SELECT TOP 1 * FROM SYS_VERSION ORDER BY cID DESC").Scan(&result)
	return result, nil
}

// NewSystemRepo .
func NewSystemRepo(data *BaseRepo, logger log.Logger) svc.SystemRepo {
	return &systemRepo{
		data: data,
		log:  log.NewHelper(logger),
	}
}
